﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SceneEngine;

namespace SceneEditor
{
    /// <summary>
    /// Provides data for the event which is raised when an object is renamed.
    /// </summary>
    public class TreeNodeMovedEventArgs : EventArgs
    {
        public TreeNodeMovedEventArgs(List<TreeNode> nodes)
        {
            this.Nodes = nodes;
        }

        public List<TreeNode> Nodes;

        public List<string> NodePaths
        {
            get
            {
                List<string> paths = new List<string>();

                foreach (TreeNode node in Nodes)
                {
                    TreeNode parent = node.Parent;
                    string nodePath = string.Empty;

                    while (parent != null)
                    {
                        nodePath = "|" + parent.Name + nodePath;
                        parent = parent.Parent;
                    }

                    if (nodePath[0] == '|')
                    {
                        nodePath = nodePath.Remove(0, 1);
                    }

                    paths.Add(nodePath);

                }
                return paths;
            }
        }
    }

    public delegate void TreeNodeMovedEventHandler(object sender, TreeNodeMovedEventArgs e);
}
